import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.ListIterator;
class Student {
    private String name;
    private int age;
    private float score;

    public Student(String name, int age, float score) {
        this.name = name;
        this.age = age;
        this.score = score;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", score=" + score +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public float getScore() {
        return score;
    }

    public void setScore(float score) {
        this.score = score;
    }
}
public class Test {
    public static ArrayList<Character> fun(String str1, String str2){
        ArrayList<Character> arrayList = new ArrayList<>();
        for (int i = 0; i < str1.length(); i++) {
            char ch = str1.charAt(i);//存每个字符
            if(!str2.contains(ch+"")){ //要传个字符串，所以要+""
                arrayList.add(ch);
            }
        }
            return arrayList;
    }

    public static void main(String[] args) {
        ArrayList<Integer> arrayList = new ArrayList<>();
        arrayList.add(1);
        arrayList.add(2);
        arrayList.add(1);
        arrayList.add(1);

    }

    public static void main3(String[] args) {
        ArrayList<String> arrayList2 = new ArrayList<>();
        ArrayList<String> arrayList3 = new ArrayList<String>();
        arrayList2.add("hello,yzh");
        ArrayList<Character> ret = fun("hello,y z h","lo ");
        for (int i = 0; i < ret.size(); i++) {
            System.out.print(ret.get(i)+" ");
        }
    }

    public static void main2(String[] args) {
        ArrayList<Student> arrayList = new ArrayList<Student>(3);
        arrayList.add(new Student("yyy", 10, 90.0f));
        arrayList.add(new Student("zzz", 20, 80.0f));
        arrayList.add(new Student("hhh", 30, 70.0f));
        System.out.println(arrayList.toString());
        System.out.println("=================================================");
        for (Student s:arrayList
             ) {
            System.out.println(s);
        }
    }

    public static void main1(String[] args) {
        ArrayList<Integer> arrayList = new ArrayList<>();
        arrayList.add(1);
        arrayList.add(2);
        arrayList.add(3);
        arrayList.add(4);
        int size = arrayList.size();
        for (int x:arrayList) {
            System.out.print(x+" ");
        }
        System.out.println();
        //  iterator迭代器
        Iterator<Integer> it = arrayList.iterator();//设置一个it在数据的上方
        while(it.hasNext()){    //先判断下一个有数据不
            System.out.print (it.next()+" ");   //it.next()往后走一步，访问+
        }

        //  ilistIterator
        ListIterator <Integer> it2 = arrayList.listIterator();//设置一个it在数据的上方
            while(it.hasNext()){    //先判断下一个有数据不
            System.out.print (it.next()+" ");   //it.next()往后走一步，访问
        }
    }
}
